#region File Description
//-----------------------------------------------------------------------------
// MainMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using FolderData;
#endregion

namespace Folder
{
    /// <summary>
    /// The main menu screen is the first thing displayed when the game starts up.
    /// </summary>
    class AuthorScreen : MenuScreen
    {

        #region Fields

        Texture2D tex_bg, tex_selected_small;

        #endregion


        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public AuthorScreen()
        {
            MenuEntry entry = new MenuEntry("Back");
            entry.Font = Fonts.ContentFont;
            entry.Position = new Vector2(950, 650);
            entry.Selected += new EventHandler<EventArgs>(entry_Selected);
            entry.isActive = true;
            MenuEntries.Add(entry);

            IsPopup = true;
        }

        void entry_Selected(object sender, EventArgs e)
        {
            ExitScreen();
            ScreenManager.AddScreen(new MainMenuScreen());
        }

        public override void LoadContent()
        {
            ContentManager content = ScreenManager.Game.Content;
            
            tex_bg = content.Load<Texture2D>("Menu/bg_author_eng");
            tex_selected_small = content.Load<Texture2D>("Menu/content_selected_small");

            base.LoadContent();
        }


        #region Update and Draw

        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }

        Rectangle active = new Rectangle(0, 0, 100, 50);
        Rectangle selected = new Rectangle(0, 50, 100, 50);
        Rectangle inactive = new Rectangle(0, 100, 100, 50);
        Rectangle menuSize = new Rectangle(0, 0, 100, 50);

        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            SpriteFont font = Fonts.HeaderFont;

            Vector2 position = new Vector2(100, 150);

            spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.SaveState);

            spriteBatch.Draw(tex_bg, Vector2.Zero, TransitionColor);

            // Draw each menu entry in turn.
            for (int i = 0; i < MenuEntries.Count; i++)
            {
                MenuEntry menuEntry = MenuEntries[i];

                bool isSelected = IsActive && (i == selectedEntry);
                if (isSelected)
                {
                    spriteBatch.Draw(tex_selected_small, menuEntry.Position + new Vector2(-5, 20), TransitionColor);
                    menuEntry.Draw(this, selected, InverseTransitionColor);
                }
                else if (menuEntry.isActive)
                {
                    menuEntry.Draw(this, active, TransitionColor);
                }
                else
                {
                    menuEntry.Draw(this, inactive, TransitionColor);
                }
            }

            spriteBatch.End();
        }
        #endregion
    }
}
